public class A04_InsertDemo04 {
    public static void main(String[] args) {
        //用递归实现1到100的加和
        int sum = getSum(100);
        System.out.println(sum);

        //实现阶乘求解
        int jc = getJC(4);
        System.out.println(jc);
    }

    public static int getSum(int number) {
        if (number == 1) {
            return 1;
        }
        return number + getSum(number - 1);
    }

    public static int getJC(int i) {
        if (i == 1) {
            return 1;
        }
        return i * getJC(i-1);
    }
}
